<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class UserBrowse extends Model
{
    use HasFactory;

    protected $table="user_browse";

    protected $guarded = [];

    public static function queryHistory($uid,$fangId,$fangType)
    {
        return self::where(['uid'=>$uid,'fang_id'=>$fangId,'fang_type' => $fangType])->first();
    }

    public static function browseHistory($uid,$fangId,$fangType)
    {
        return self::create(['uid'=>$uid,'fang_id'=>$fangId,'fang_type' => $fangType]);
    }

    public static function browseList($uid,$fangType)
    {
        return self::where(['uid'=>$uid,'fang_type' => $fangType])->get();
    }

}
